@c Copyright @copyright{} 2022 Yevhen Babiichuk (DustDFG).

@node Top
@top Human Friendly Inkscape Designer

@node Preface
@chapter Preface

Inkscape is a free SVG editor that gives you an opportunity to create excellent
artworks without big difficulties. This very comfortable tool doesn't try to
limit you, so you are free to draw whatever you want but this extremely powerful
tool needs your attention, without which you won't create clear and human
readable artwork.

The book was written to teach you how to avoid disadventages of Inkscape which
prevent you from creating graceful, readable and human friendly artworks. It
will teach you how to become an excellent "Human Friendly Inkscape Designer".

@node Metadata
@chapter Metadata

Metadata is data that describes other data. You can see it in a simple example.
Artwork that you create is data, it doesn't describe something else. On the
contrary, information about size describes property of artwork, so it is
metadata.

@node Metadata carrier
@section Metadata carrier

SVG supports all XML facilities, including namespaces. Their strength lies in
the fact that they allow you to include some data to the document without any
conflicts. Namespaces provide you an opprtunity to define uniqely named scopes
for elements and attributes, which won't conflict with elements and attributes
from other scopes. They are the main way to provide metadata inside the
document.

The syntax of namespaces is very simple. Declaration of the namespaces uses
@code{xmlns:@var{namespace_name}="@var{namespace_uri}"} syntax. After declaring
namespace it becomes available to use. To point namespace for element or
attribute you need to use
@code{@var{namespace_name}:@var{element_name}} or
@code{@var{namespace_name}:@var{attribute_name}} syntax, respectively.
XML standard says that you have an opportunity to declare @var{default}
namespace with @code{xmlns="@var{namespace_uri}"} syntax. It means that all the
elements and attributes declared without qualification namespace belongs to the
@var{default} namespace. You could see its decaration for SVG before in your
artwoks as @code{xmlns="http://www.w3.org/2000/svg"}.

@node RDF metadata
@section RDF metadata

SVG standard defines @code{metadata} element intended to store all general
metadata about the document. The standard doesn't define any elements or
attributes tha can be nested in the @code{metadata} element. It suppose that
all nested elements will belong to other namespaces.

Inkscape uses for that purpose three genral namespaces:
@code{xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
@code{xmlns:cc="http://creativecommons.org/ns#"},
@code{xmlns:dc="http://purl.org/dc/elements/1.1/"}

@node Inkscape metadata
@section Inkscape metadata

Inkscape uses some abstractions to make some things easier (mostly for itself).
It represents these abstractions as metadata inside your artwork. Usually it
is useful while you are in creation process but it is almost useless when work
is finished. Inkscape stores @emph{almost} all its own metadata in two
namespaces @code{inkscape} and @code{sodipodi} that declared in the document as
@code{xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"} and
@code{xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"}
@footnote{Inkscape is a derivative of an old vector image editor with name
Sodipodi. Inkscape uses sodipodi metadata namespace for backward
compatibility.} respectively. They declares some attributes, which will be
described later and only one element @code{sodipodi:namedview} (place where you
will find about half of these attributes).

@node Inkscape general document metadata
@subsection Inkscape general document metadata

Inkscape uses some attributes to store general information about the document.

@multitable @columnfractions .15 .35 .5
@headitem Element @tab Attribute @tab Description

@item @code{svg}
@tab @code{sodipodi:version}
@tab Stores information about version of Sodipodi in which document was
created.

@item @code{svg}
@tab @code{inkscape:version}
@tab Stores information about version of Inkscape in which document was
created.

@item @code{svg}
@tab @code{sodipodi:docname}
@tab Stores name of document.

@item @code{svg}
@tab @code{sodipodi:docbase}
@tab Stores path to the document.

@end multitable

@quotation Note
@code{sodipodi:version} attribute is obsolescent.
@end quotation

@quotation Warning
@code{sodipodi:docbase} attribute can contain your sensitive information.
@end quotation

@quotation Tip
These attributes, except maybe @code{inkscape:version}, should not appear in
release version of work, they are redudant and useless.
@end quotation

@node Inkscape export metadata
@subsection Inkscape export metadata

When you export your artwork in a fromat different from SVG, Inkscape adds to
the document three metadata attributes that represent options, used during last
export.

@multitable @columnfractions .15 .35 .5
@headitem Element @tab Attribute @tab Description

@item @code{svg}
@tab @code{inkscape:export-xdpi}
@tab Stores information about @abbr{DPI, Dots Per Inch} by x axis, used during
export.

@item @code{svg}
@tab @code{inkscape:export-ydpi}
@tab Stores information about @abbr{DPI, Dots Per Inch} by y axis, used during
export.

@item @code{svg}
@tab @code{inkscape:export-filename}
@tab Stores path to the file or its name, used during export.

@end multitable

@quotation Note
Inkscape rewrite these attributes with new values each time you export the
work.
@end quotation

@quotation Warning
@code{inkscape:export-filename} attribute can contain your sensitive
information.
@end quotation

@quotation Tip
These attributes should not appear in release version of work, they are
redudant and useless.
@end quotation

@node Inkscape layers metadata
@subsection Inkscape layers metadata

Information about layers is the most useful metadata stored by Inkscape.

@multitable @columnfractions .15 .35 .5
@headitem Element @tab Attribute @tab Description

@item @code{g}
@tab @code{inkscape:groupmode="layer"}
@tab Mark @code{g} element as @var{Inkscape layer}.

@item @code{g}
@tab @code{inkscape:label}
@tab Contains name of @var{Inkscape layer} displayed by Inkscape in
@samp{Layers} tab.

@item @code{g}
@tab @code{sodipodi:insensitive="true"}
@tab Mark @var{Inkscape layer} as immutable.

@item @code{sodipodi:namedview}
@tab @code{inkscape:current-layer}
@tab Contains value of @code{id} attribute of @code{g} element that represents
selected @var{Inkscape layer}.

@end multitable

@quotation Tip
These metadata attributes are very useful so you should keep them except the
last two because they don't have much sense for release version of work.
@end quotation

@node Suboptimal solutions
@chapter Suboptimal solutions

Inkscape is a smart tool but it doesn't (can't) check most semantic features of
the artwork elements so it often produces suboptimal solutions.

@node Circles saved as ellipses
@section Circles saved as ellipses

When you use Inkscapes tool @samp{Ellipse}, you can create ellipses that looks
like circles. The problem appears because it is almost impossible create by
eye ideal circle with tool that uses floating point numbers. You will think
that you created a circle, it will have almost equal @code{rx} and @code{ry}
attributes so Inkscape will think that it is an ellipse. You will see object
that looks like circe but Inkscape will save it as ellipse. It can be really
misleading so you should try to avoid these situations. Fortunately it is
simple to correct code. You just need to rename elemnet and replace @code{rx}
and @code{ry} attributes with @code{r} one.

@quotation Tip
To fix the problem directly from Inkscape you need to follow the one of the
instructions described below. (They don't always work)

Instruction one:

@enumerate

@item
Select @samp{Ellipse} tool.

@item
Select an ellipse that you need to convert to a circle.

@item
Make values @samp{Rx} and @samp{Ry} from input fields that appeared in
@var{Tool controls bar} when you selected an ellipse equal.

@end enumerate
@end quotation

@node Formatting
@chapter Formatting

Formatting is a very important part of each document. Bad or inconsistent
formatting will make your document difficult to read and understand.

@node Identation
@section Identation

Identation of code is a method of emphasizing semantic properties of the code.

SVG code, which is XML, is a tree of elements nested one inside the other. XML
formatting best practices is also applicable to SVG so you should follow them.

@node Identation characters
@subsection Identation characters

It is a holywar topic which character to use for identation purposes. Each
designer has their own preferences. Some of them prefer spaces, others prefer
tabs just like me. I advise you to use tabs beacuse it is a dynamically "wide"
character. Each designer will be able to choose their own width for display so
everyone will be happy. As a bonus of using tabs, you will get a reduction of
file size ;)

